package org.xiaofeipapa.feimall.orderApi.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.xiaofeipapa.feimall.orderApi.service.OrderService;

import javax.annotation.Resource;

/**
 */
@RestController
public class OrderApiController {

    @Value("${server.port}")
    private String serverPort;

    @Resource
    OrderService orderService;

    @RequestMapping(value="/hello", method = RequestMethod.GET)
    private String hello(){
        return "我是 order service, 端口为： " + serverPort;
    }

    @GetMapping(value="/buy")
    private String buy(@RequestParam String userName){
        orderService.createOrder(userName);
        return "success";
    }

}
